<?php
/**
 * Created by PhpStorm.
 * User: deng
 * Date: 2015/3/6
 * Time: 12:50
 */

namespace Test\Controller;

use Think\Controller;

import('Jwt.JWT', VENDOR_PATH, '.php');

class JwtController extends Controller
{
    function index()
    {
        $msg = \JWT::encode('abc', 'my_key');
        echo(\JWT::decode($msg, 'my_key') === 'abc');
        $array = [
            'username' => '1',
            'token' => '1',
            'fuck' => 1
        ];
        $msg = \JWT::encode($array, 'my_key');
        print_r(\JWT::decode($msg, 'my_key'));
    }
}